<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>广州市来穗局信息管理系统</title>
<%@ include file="/common/taglibs.jsp" %>
<link href="${ctx }/common/css/common.css" type="text/css" rel="stylesheet" />
<script type="text/javascript">


	$(function() {
		localStorage.removeItem("accessToken");
		localStorage.removeItem("freshToken");
		
		$(this).keydown(function(event) {
			if (event.keyCode == 13) {
				login();
			}
		});
	});

	function login() {
		var f = $("#form").serialize();
		$.ajax({
			url : "${ctx}/loginController/login",
			data : f,
			dataType : "json",
			type : "POST",
			async : false,
			success : function(data) {
				if (data.ack_code == "SUCCESS") {
					$("#user_msg").html("登录成功，开始转跳").css({
						"color" : "red",
						"font-size" : "250%"
					});
					var token = data.token;
					
					localStorage.accessToken= token.accessToken;
					window.location.href ="${ctx}/main.jsp";
				} else {
					$("#user_msg").html(data.error_message).css({
						"color" : "red",
						"font-size" : "250%"
					});
				}
			},
			error : function() {
				alert("系统繁忙，请稍后再试");
			}
		})

	}

	</script>
</head>

<body style="background-color: #133f89;">
	<div class="login_all">
		<div class="login_all_bg">
			<!-- top logo -->
			<div class="top_logo">
				<img src="${ctx}/custom/image/login_logo.png" />
			</div>

			<!-- user_msg -->
			<form id="form" class="loginForm">
				<div class="user_msg">
					<div id="user_msg"></div>
					<p>
						<img src="${ctx}/custom/image/admin.png" /><input type="text"
							id="user_name" name="dlm" class="user_text"
							placeholder="请输入您的账号..." value="" />
						<!-- 样式加载class=user_text上，请勿改动类名 -->
					</p>
				</div>
				<div class="user_msg">
					<p>
						<img src="${ctx}/custom/image/psw.png" /><input type="password"
							id="user_psw" value="" name="dlkl" class="user_text"
							placeholder="请输入您的密码..." />
						<!-- 样式加载class=user_text上，请勿改动类名 -->
					</p>
				</div>
				<div class="user_msg">
					<a href="javascript:void(0)" onclick="login()"> <img
						src="${ctx}/custom/image/login_btn.png" />
					</a>
				</div>
			</form>
			<div class="login_footer">
				<p>技术支持：广州市图南软件科技有限公司</p>
			</div>
		</div>
	</div>
</body>
</html>